<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>axios入门案例</title>
	</head>
	<body>
		<h1>Axios ajax的调用</h1>
	</body>
	<script src="../js/axios.js"></script>
	<script>
		//发起get请求
		// 跨域请求，浏览器不能正常执行
var params = new URLSearchParams()
axios.default.baseURL="http://localhost:8080/"
 params.append('id', 100)
		axios.post("hello",{
			id:1,
			name:"我是猪"
		}).then(
			result=> {
				result.method="post"
				console.log(result)
				console.log(result.data)
			}
		)
		axios.get("hello",{
			params:{
				id:100
			}
		}).then(
			result=> {
				result.method="get"
				console.log(result)
				console.log("get"+result.data)
			}
		)
		//定义一个form表单对象
		//async await
	</script>
</html>
